package com.lk.demo.service;

import com.lk.demo.model.Author;
import com.lk.demo.repos.AuthorRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class AuthorService {
    @Autowired
    private AuthorRepository authorRepository;
    public Author save(Author author)
    {
        return authorRepository.save(author);
    }
    public Author get(Long id)
    {
        return authorRepository.findById(id).orElse(null);
    }
    public String delete(Long id)
    {
        authorRepository.deleteById(id);
        return "success";
    }
}
